<?php
namespace AuctionBack\Controller;


/**
 * 后台首页控制器
 * 主要获取首页聚合数据
 */
class IndexController extends BaseController
{
    public function __construct()
    {
        parent::__construct();
    }

    //首页
    public function index()
    {
        $this->display();
    }

    //门店api
    public function stores()
    {
        $list = C("STORE");
        //$this->helpJsonResult(200,'stores',$list);
        echo \AuctionCore\Common\Util::auto_jsonp_or_json($_REQUEST, array('code' => 200, 'msg' => '', 'data' => $list), true);
        exit;
    }

    //门店雇员
    public function store_employee()
    {
        $sid = I('request.sid/d');
        $gid = I('request.gid/d', 0);
        if ($sid < 1) {
            echo \AuctionCore\Common\Util::auto_jsonp_or_json($_REQUEST, array('code' => 400, 'msg' => '门店ID不能为空', 'data' => ''), true);
            exit;
        }
        if ($gid < 1) {
            echo \AuctionCore\Common\Util::auto_jsonp_or_json($_REQUEST, array('code' => 400, 'msg' => '组ID不能为空', 'data' => ''), true);
            exit;
        }
        $list = \AuctionCore\Account\Back\Employee::get_emp_by_store_group($sid, $gid);
        echo \AuctionCore\Common\Util::auto_jsonp_or_json($_REQUEST, array('code' => 200, 'msg' => 'list', 'data' => $list), true);
        exit;
    }
}
